#include "EWAUIWidgetVerticalSegBar.hpp"

namespace Eyer
{
    int EWAUIWidgetVerticalSegBar::OnDraw()
    {
        RemoveAllUIGraph();

        EyerSmartPtr<EWAUIGraphRect> rect(new EWAUIGraphRect());
        rect->xy.SetX(0);
        rect->xy.SetY(0);
        rect->wh = wh;
        rect->background = bgColor;
        AddUIGraph(rect);

        EyerSmartPtr<EWAUIGraphLine> bottomLine(new EWAUIGraphLine());
        bottomLine->xyStart.x(0);
        bottomLine->xyStart.y(wh.h() - 1);
        bottomLine->xyEnd.x(wh.w());
        bottomLine->xyEnd.y(wh.h() - 1);
        bottomLine->linecolor = EyerColor::BLACK;
        AddUIGraph(bottomLine);

        EyerSmartPtr<EWAUIGraphLine> topLine(new EWAUIGraphLine());
        topLine->xyStart.x(0);
        topLine->xyStart.y(0 + 1);
        topLine->xyEnd.x(wh.w());
        topLine->xyEnd.y(0 + 1);
        topLine->linecolor = EyerColor::BLACK;
        AddUIGraph(topLine);

        return 0;
    }

    EWAUIWidgetVerticalSegBar::EWAUIWidgetVerticalSegBar(EWAUILayoutParams _width, EWAUILayoutParams _height)
        : EWAUIWidget(_width, _height)
    {
        SetWidgetName("EWAUIWidgetVerticalSegBar");
        SetMinHeight(4);
        bgColor = EyerColor::GRAY_85;
    }
}